+Mon Apr 30 19:18:07 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkstyle.[ch] gtk/gtkaccellabel.c gtk/gtkcellrenderertext.c
+ gtk/gtkhruler.c gtk/gtkhscale.c gtk/gtklabel.c gtk/gtkprogressbar.c
+ gtk/gtkvruler.c gtk/gtkvscale.c: Add an extra parameter
+ use_text to gtk_paint_label() to deal with style->bg[] vs style->text[].
+
+ * gtk/gtkbbox.c gtk/gtkdialog.c: Tweak padding some to deal
+ with GtkWidget::interior_focus = TRUE better.
+
+ * gtk/gtkbutton.c
+
+ * gtk/gtkwidget.c (gtk_widget_style_get_valist): Remove
+ G_VALUE_NO_COPY_CONTENTS, to correspond with the recent
+ change that had to be made with g_object_get.
+
Sun Apr 29 20:13:40 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_columns): new function.
+Mon Apr 30 19:18:07 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkstyle.[ch] gtk/gtkaccellabel.c gtk/gtkcellrenderertext.c
+ gtk/gtkhruler.c gtk/gtkhscale.c gtk/gtklabel.c gtk/gtkprogressbar.c
+ gtk/gtkvruler.c gtk/gtkvscale.c: Add an extra parameter
+ use_text to gtk_paint_label() to deal with style->bg[] vs style->text[].
+
+ * gtk/gtkbbox.c gtk/gtkdialog.c: Tweak padding some to deal
+ with GtkWidget::interior_focus = TRUE better.
+
+ * gtk/gtkbutton.c
+
+ * gtk/gtkwidget.c (gtk_widget_style_get_valist): Remove
+ G_VALUE_NO_COPY_CONTENTS, to correspond with the recent
+ change that had to be made with g_object_get.
+
Sun Apr 29 20:13:40 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_columns): new function.
+Mon Apr 30 19:18:07 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkstyle.[ch] gtk/gtkaccellabel.c gtk/gtkcellrenderertext.c
+ gtk/gtkhruler.c gtk/gtkhscale.c gtk/gtklabel.c gtk/gtkprogressbar.c
+ gtk/gtkvruler.c gtk/gtkvscale.c: Add an extra parameter
+ use_text to gtk_paint_label() to deal with style->bg[] vs style->text[].
+
+ * gtk/gtkbbox.c gtk/gtkdialog.c: Tweak padding some to deal
+ with GtkWidget::interior_focus = TRUE better.
+
+ * gtk/gtkbutton.c
+
+ * gtk/gtkwidget.c (gtk_widget_style_get_valist): Remove
+ G_VALUE_NO_COPY_CONTENTS, to correspond with the recent
+ change that had to be made with g_object_get.
+
Sun Apr 29 20:13:40 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_columns): new function.
+Mon Apr 30 19:18:07 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkstyle.[ch] gtk/gtkaccellabel.c gtk/gtkcellrenderertext.c
+ gtk/gtkhruler.c gtk/gtkhscale.c gtk/gtklabel.c gtk/gtkprogressbar.c
+ gtk/gtkvruler.c gtk/gtkvscale.c: Add an extra parameter
+ use_text to gtk_paint_label() to deal with style->bg[] vs style->text[].
+
+ * gtk/gtkbbox.c gtk/gtkdialog.c: Tweak padding some to deal
+ with GtkWidget::interior_focus = TRUE better.
+
+ * gtk/gtkbutton.c
+
+ * gtk/gtkwidget.c (gtk_widget_style_get_valist): Remove
+ G_VALUE_NO_COPY_CONTENTS, to correspond with the recent
+ change that had to be made with g_object_get.
+
Sun Apr 29 20:13:40 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_columns): new function.
+Mon Apr 30 19:18:07 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkstyle.[ch] gtk/gtkaccellabel.c gtk/gtkcellrenderertext.c
+ gtk/gtkhruler.c gtk/gtkhscale.c gtk/gtklabel.c gtk/gtkprogressbar.c
+ gtk/gtkvruler.c gtk/gtkvscale.c: Add an extra parameter
+ use_text to gtk_paint_label() to deal with style->bg[] vs style->text[].
+
+ * gtk/gtkbbox.c gtk/gtkdialog.c: Tweak padding some to deal
+ with GtkWidget::interior_focus = TRUE better.
+
+ * gtk/gtkbutton.c
+
+ * gtk/gtkwidget.c (gtk_widget_style_get_valist): Remove
+ G_VALUE_NO_COPY_CONTENTS, to correspond with the recent
+ change that had to be made with g_object_get.
+
Sun Apr 29 20:13:40 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_columns): new function.
+Mon Apr 30 19:18:07 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkstyle.[ch] gtk/gtkaccellabel.c gtk/gtkcellrenderertext.c
+ gtk/gtkhruler.c gtk/gtkhscale.c gtk/gtklabel.c gtk/gtkprogressbar.c
+ gtk/gtkvruler.c gtk/gtkvscale.c: Add an extra parameter
+ use_text to gtk_paint_label() to deal with style->bg[] vs style->text[].
+
+ * gtk/gtkbbox.c gtk/gtkdialog.c: Tweak padding some to deal
+ with GtkWidget::interior_focus = TRUE better.
+
+ * gtk/gtkbutton.c
+
+ * gtk/gtkwidget.c (gtk_widget_style_get_valist): Remove
+ G_VALUE_NO_COPY_CONTENTS, to correspond with the recent
+ change that had to be made with g_object_get.
+
Sun Apr 29 20:13:40 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_columns): new function.
+Mon Apr 30 19:18:07 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkstyle.[ch] gtk/gtkaccellabel.c gtk/gtkcellrenderertext.c
+ gtk/gtkhruler.c gtk/gtkhscale.c gtk/gtklabel.c gtk/gtkprogressbar.c
+ gtk/gtkvruler.c gtk/gtkvscale.c: Add an extra parameter
+ use_text to gtk_paint_label() to deal with style->bg[] vs style->text[].
+
+ * gtk/gtkbbox.c gtk/gtkdialog.c: Tweak padding some to deal
+ with GtkWidget::interior_focus = TRUE better.
+
+ * gtk/gtkbutton.c
+
+ * gtk/gtkwidget.c (gtk_widget_style_get_valist): Remove
+ G_VALUE_NO_COPY_CONTENTS, to correspond with the recent
+ change that had to be made with g_object_get.
+
Sun Apr 29 20:13:40 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_columns): new function.
gtk_paint_layout (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
+ FALSE,
&event->area,
widget,
"accellabel",
#define DEFAULT_CHILD_MIN_WIDTH 85
#define DEFAULT_CHILD_MIN_HEIGHT 27
-#define DEFAULT_CHILD_IPAD_X 7
+#define DEFAULT_CHILD_IPAD_X 4
#define DEFAULT_CHILD_IPAD_Y 0
GtkType
#include "gtkintl.h"
#define CHILD_SPACING 1
-#define DEFAULT_SPACING 7
+
+static GtkBorder default_default_border = { 5, 5, 6, 6 };
+static GtkBorder default_default_outside_border = { 5, 5, 6, 6 };
/* Time out before giving up on getting a key release when animatng
* the close button.
widget_class->activate_signal = button_signals[ACTIVATE];
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("default_spacing",
- _("Default Spacing"),
- _("Extra space to add for CAN_DEFAULT buttons"),
- 0,
- G_MAXINT,
- DEFAULT_SPACING,
- G_PARAM_READABLE));
+ g_param_spec_boxed ("default_border",
+ _("Default Spacing"),
+ _("Extra space to add for CAN_DEFAULT buttons"),
+ GTK_TYPE_BORDER,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("default_outside_border",
+ _("Default Outside Spacing"),
+ _("Extra space to add for CAN_DEFAULT buttons that is always drawn outside the border"),
+ GTK_TYPE_BORDER,
+ G_PARAM_READABLE));
}
static void
static void
gtk_button_get_props (GtkButton *button,
- gint *default_spacing,
+ GtkBorder *default_border,
+ GtkBorder *default_outside_border,
gboolean *interior_focus)
{
GtkWidget *widget = GTK_WIDGET (button);
+ GtkBorder *tmp_border;
+
+ if (default_border)
+ {
+ gtk_widget_style_get (widget, "default_border", &tmp_border, NULL);
+
+ if (tmp_border)
+ {
+ *default_border = *tmp_border;
+ g_free (tmp_border);
+ }
+ else
+ *default_border = default_default_border;
+ }
- if (default_spacing)
- gtk_widget_style_get (widget, "default_spacing", default_spacing, NULL);
+ if (default_outside_border)
+ {
+ gtk_widget_style_get (widget, "default_outside_border", &tmp_border, NULL);
+
+ if (tmp_border)
+ {
+ *default_outside_border = *tmp_border;
+ g_free (tmp_border);
+ }
+ else
+ *default_outside_border = default_default_outside_border;
+ }
if (interior_focus)
gtk_widget_style_get (widget, "interior_focus", interior_focus, NULL);
GtkRequisition *requisition)
{
GtkButton *button = GTK_BUTTON (widget);
- gint default_spacing;
+ GtkBorder default_border;
gboolean interior_focus;
- gtk_button_get_props (button, &default_spacing, &interior_focus);
+ gtk_button_get_props (button, &default_border, NULL, &interior_focus);
requisition->width = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
GTK_WIDGET (widget)->style->xthickness) * 2;
if (GTK_WIDGET_CAN_DEFAULT (widget))
{
- requisition->width += (GTK_WIDGET (widget)->style->xthickness * 2 +
- default_spacing);
- requisition->height += (GTK_WIDGET (widget)->style->ythickness * 2 +
- default_spacing);
+ requisition->width += default_border.left + default_border.right;
+ requisition->height += default_border.top + default_border.bottom;
}
if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
gint border_width = GTK_CONTAINER (widget)->border_width;
gint xthickness = GTK_WIDGET (widget)->style->xthickness;
gint ythickness = GTK_WIDGET (widget)->style->ythickness;
- gint default_spacing;
+ GtkBorder default_border;
- gtk_button_get_props (button, &default_spacing, NULL);
+ gtk_button_get_props (button, &default_border, NULL, NULL);
widget->allocation = *allocation;
if (GTK_WIDGET_CAN_DEFAULT (button))
{
- child_allocation.x += (GTK_WIDGET (widget)->style->xthickness +
- (1 + default_spacing) / 2);
- child_allocation.y += (GTK_WIDGET (widget)->style->ythickness +
- (1 + default_spacing) / 2);
- child_allocation.width = MAX (1, (gint)child_allocation.width -
- (gint)(GTK_WIDGET (widget)->style->xthickness * 2 + default_spacing));
- child_allocation.height = MAX (1, (gint)child_allocation.height -
- (gint)(GTK_WIDGET (widget)->style->xthickness * 2 + default_spacing));
+ child_allocation.x += default_border.left;
+ child_allocation.y += default_border.top;
+ child_allocation.width = MAX (1, child_allocation.width - default_border.left - default_border.right);
+ child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom);
}
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
GtkShadowType shadow_type;
gint width, height;
gint x, y;
- gint default_spacing;
+ GtkBorder default_border;
+ GtkBorder default_outside_border;
gboolean interior_focus;
if (GTK_WIDGET_DRAWABLE (widget))
{
button = GTK_BUTTON (widget);
- gtk_button_get_props (button, &default_spacing, &interior_focus);
+ gtk_button_get_props (button, &default_border, &default_outside_border, &interior_focus);
x = 0;
y = 0;
GTK_STATE_NORMAL, GTK_SHADOW_IN,
area, widget, "buttondefault",
x, y, width, height);
- }
- if (GTK_WIDGET_CAN_DEFAULT (widget))
+ x += default_border.left;
+ y += default_border.top;
+ width -= default_border.left + default_border.right;
+ height -= default_border.top + default_border.bottom;
+ }
+ else if (GTK_WIDGET_CAN_DEFAULT (widget))
{
- x += widget->style->xthickness;
- y += widget->style->ythickness;
- width -= 2 * x + default_spacing;
- height -= 2 * y + default_spacing;
- x += (1 + default_spacing) / 2;
- y += (1 + default_spacing) / 2;
+ x += default_outside_border.left;
+ y += default_outside_border.top;
+ width -= default_outside_border.left + default_outside_border.right;
+ height -= default_outside_border.top + default_outside_border.bottom;
}
if (!interior_focus && GTK_WIDGET_HAS_FOCUS (widget))
gtk_paint_layout (widget->style,
window,
state,
+ TRUE,
cell_area,
widget,
"cellrenderertext",
_("Spacing between buttons"),
0,
G_MAXINT,
- 1,
+ 10,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
_("Width of border around the button area at the bottom of the dialog"),
0,
G_MAXINT,
- 0,
+ 5,
G_PARAM_READABLE));
}
gtk_paint_layout (widget->style,
ruler->backing_store,
GTK_WIDGET_STATE (widget),
+ FALSE,
NULL,
widget,
"hruler",
gtk_paint_layout (widget->style,
widget->window,
state_type,
+ FALSE,
NULL,
widget,
"hscale",
gtk_paint_layout (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
+ FALSE,
&event->area,
widget,
"label",
struct _GtkOptionMenuProps
{
+ gboolean interior_focus;
GtkRequisition indicator_size;
GtkBorder indicator_spacing;
};
static GtkOptionMenuProps default_props = {
+ FALSE,
{ 12, 8 },
{ 3, 7, 2, 2 } /* Left, right, top, bottom */
};
gtk_widget_style_get (GTK_WIDGET (option_menu),
"indicator_size", &indicator_size,
"indicator_spacing", &indicator_spacing,
+ "interior_focus", &props->interior_focus,
NULL);
if (indicator_size)
if (GTK_WIDGET_DRAWABLE (widget))
{
+ gint border_width = GTK_CONTAINER (widget)->border_width;
+
gtk_option_menu_get_props (GTK_OPTION_MENU (widget), &props);
- button_area.x = GTK_CONTAINER (widget)->border_width + 1;
- button_area.y = GTK_CONTAINER (widget)->border_width + 1;
- button_area.width = widget->allocation.width - button_area.x * 2;
- button_area.height = widget->allocation.height - button_area.y * 2;
+ button_area.x = border_width;
+ button_area.y = border_width;
+ button_area.width = widget->allocation.width - 2 * border_width;
+ button_area.height = widget->allocation.height - 2 * border_width;
- /* This is evil, and should be elimated here and in the button
- * code. The point is to clear the focus, and make it
- * sort of transparent if it isn't there.
- */
- gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
- gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
+ if (!props.interior_focus)
+ {
+ button_area.x += 1;
+ button_area.y += 1;
+ button_area.width -= 2;
+ button_area.height -= 2;
+
+ /* This is evil, and should be elimated here and in the button
+ * code. The point is to clear the focus, and make it
+ * sort of transparent if it isn't there.
+ */
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+ gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
+ }
gtk_paint_box(widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
props.indicator_size.width, props.indicator_size.height);
if (GTK_WIDGET_HAS_FOCUS (widget))
- gtk_paint_focus (widget->style, widget->window,
- area, widget, "button",
- button_area.x - 1,
- button_area.y - 1,
- button_area.width + 1,
- button_area.height + 1);
+ {
+ if (props.interior_focus)
+ {
+ button_area.x += widget->style->xthickness + 1;
+ button_area.y += widget->style->ythickness + 1;
+ button_area.width -= 2 * (widget->style->xthickness + 1)
+ + props.indicator_spacing.left + props.indicator_spacing.right + props.indicator_size.width;
+ button_area.height -= 2 * (widget->style->ythickness + 1);
+ }
+ else
+ {
+ button_area.x -= 1;
+ button_area.y -= 1;
+ button_area.width += 2;
+ button_area.height += 2;
+ }
+
+ gtk_paint_focus (widget->style, widget->window,
+ area, widget, "button",
+ button_area.x,
+ button_area.y,
+ button_area.width - 1,
+ button_area.height - 1);
+ }
}
}
gtk_paint_layout (widget->style,
progress->offscreen_pixmap,
GTK_WIDGET_STATE (widget),
+ FALSE,
&rect,
widget,
"progressbar",
static void gtk_default_draw_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
+ gboolean use_text,
GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gtk_draw_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
+ gboolean use_text,
gint x,
gint y,
PangoLayout *layout)
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_layout != NULL);
- GTK_STYLE_GET_CLASS (style)->draw_layout (style, window, state_type,
+ GTK_STYLE_GET_CLASS (style)->draw_layout (style, window, state_type, use_text,
NULL, NULL, NULL,
x, y, layout);
}
gtk_default_draw_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
+ gboolean use_text,
GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint y,
PangoLayout *layout)
{
+ GdkGC *gc;
+
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (window != NULL);
+
+ gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type];
if (area)
- gdk_gc_set_clip_rectangle (style->text_gc[state_type], area);
+ gdk_gc_set_clip_rectangle (gc, area);
if (state_type == GTK_STATE_INSENSITIVE)
{
ins = get_insensitive_layout (layout);
- gdk_draw_layout (window, style->text_gc[state_type], x, y, ins);
+ gdk_draw_layout (window, gc, x, y, ins);
g_object_unref (G_OBJECT (ins));
}
else
{
- gdk_draw_layout (window, style->text_gc[state_type], x, y, layout);
+ gdk_draw_layout (window, gc, x, y, layout);
}
if (area)
- gdk_gc_set_clip_rectangle (style->text_gc[state_type], NULL);
+ gdk_gc_set_clip_rectangle (gc, NULL);
}
static void
gtk_paint_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
+ gboolean use_text,
GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_layout != NULL);
- GTK_STYLE_GET_CLASS (style)->draw_layout (style, window, state_type, area,
+ GTK_STYLE_GET_CLASS (style)->draw_layout (style, window, state_type, use_text, area,
widget, detail, x, y, layout);
}
void (*draw_layout) (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
+ gboolean use_text,
GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
void gtk_draw_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
+ gboolean use_text,
gint x,
gint y,
PangoLayout *layout);
void gtk_paint_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
+ gboolean use_text,
GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gtk_paint_layout (widget->style,
ruler->backing_store,
GTK_WIDGET_STATE (widget),
+ FALSE,
NULL,
widget,
"vruler",
gtk_paint_layout (widget->style,
widget->window,
state_type,
+ FALSE,
NULL,
widget,
"vscale",
G_OBJECT_TYPE (widget),
pspec,
g_param_spec_get_qdata (pspec, quark_property_parser));
- G_VALUE_LCOPY (peek_value, var_args, G_VALUE_NOCOPY_CONTENTS, &error);
+ G_VALUE_LCOPY (peek_value, var_args, 0, &error);
if (error)
{
g_warning ("%s: %s", G_STRLOC, error);